package com.lfs.admin.feign;

import cn.hutool.json.JSONObject;
import com.lfs.admin.model.dto.PddProductPropertyDto;
import com.lfs.base.dto.Result;
import com.lfs.interfaces.dto.ResultReturn;
import com.lfs.interfaces.dto.TokenCreateDto;
import com.lfs.interfaces.model.NotifyModel;
import com.lfs.interfaces.model.dto.OrderDto;
import com.lfs.interfaces.model.vo.ChargeVo;
import com.lfs.interfaces.model.vo.LogisticsTemplateVo;
import com.lfs.interfaces.model.vo.MallInfoVo;
import com.lfs.interfaces.model.vo.TokenCreateVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(name="lfs-adapter")
public interface AdapterFeignService {

    /**
     * 调用适配器服务获取平台鉴权url地址
     * @return tokenCreateDto
     */
    @RequestMapping(value = "platform/getAuthUrl", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getAuthUrl(@RequestBody TokenCreateDto tokenCreateDto);

    /**
     * 调用适配器服务获取平台授权token
     * @return TokenCreateVo
     */
    @RequestMapping(value = "platform/getAccessToken", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<TokenCreateVo> getAccessToken(@RequestBody TokenCreateDto tokenCreateDto);

    /**
     * 调用适配器服务发起上架发布商品
     */
    @RequestMapping(value = "platform/releaseProduct", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> releaseProduct();

    /**
     * 获取商品类目列表信息
     */
    @RequestMapping(value = "platform/getGoodsCats", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<JSONObject> getGoodsCats();

    /**
     * 获取商品运费模版信息
     */
    @RequestMapping(value = "platform/getLogisticsTemplate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<List<LogisticsTemplateVo>> getLogisticsTemplate();

    /**
     * 获取商品运费模版信息
     */
    @RequestMapping(value = "platform/getMallInfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<MallInfoVo> getMallInfo(@RequestBody TokenCreateDto tokenCreateDto);

    /**
     * 获取商品类目发布规则
     */
    @RequestMapping(value = "platform/getGoodsCatRule", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<JSONObject> getGoodsCatRule();

    /**
     * 获取商品类目信息
     */
    @RequestMapping(value = "platform/getCurrentCommodityCategory", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getCurrentCommodityCategory(@RequestParam("accessToken") String accessToken);

    /**
     * 查询品牌
     */
    @RequestMapping(value = "platform/searchPddBrand", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> searchPddBrand(@RequestParam("value") String value, @RequestParam("catId") Long catId, @RequestParam("refPid") Long refPid, @RequestParam("accessToken") String accessToken);

    /**
     * 查询运费模板
     */
    @RequestMapping(value = "platform/getFreightTemplateData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getFreightTemplateData(@RequestParam("accessToken") String accessToken);

    /**
     * 关联视频
     */
    @RequestMapping(value = "platform/getVideoData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getVideoData(@RequestParam("accessToken") String accessToken);

    /**
     * 获取商品属性
     */
    @RequestMapping(value = "platform/getCurrentGoodsInfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getCurrentGoodsInfo(@RequestParam("catId") Long catId, @RequestParam("accessToken") String accessToken);

    /**
     * 获取商品两件折扣属性
     */
    @RequestMapping(value = "platform/getTwoPiecesDiscountRule", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getTwoPiecesDiscountRule(@RequestParam("catId") Long catId, @RequestParam("accessToken") String accessToken);

    /**
     * 获取商品规格
     */
    @RequestMapping(value = "platform/getGoodsSpecifications", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getGoodsSpecifications(@RequestParam("catId") Long catId, @RequestParam("accessToken") String accessToken);

    /**
     * 自定义的规格
     */
    @RequestMapping(value = "platform/getCustomSpecifications", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getCustomSpecifications(@RequestParam("parentSpecId")Long parentSpecId, @RequestParam("specName")String specName, @RequestParam("accessToken") String accessToken);

    /**
     * 商品图片上传接口
     */
    @RequestMapping(value = "platform/goodsImgUpload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> goodsImgUpload(@RequestParam("fileUrl") String fileUrl, @RequestParam("accessToken") String accessToken);
    /**
     * 图片上传到图片空间
     */
    @RequestMapping(value = "platform/filesPaceImgUpload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> filesPaceImgUpload(@RequestParam("fileUrl") String fileUrl, @RequestParam("accessToken") String accessToken);


    /**
     * 发布商品
     */
    @RequestMapping(value = "platform/releaseGoods", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<Map<String, Object>> releaseGoods(@RequestBody PddProductPropertyDto pddProductPropertyDto, @RequestParam("accessToken") String accessToken);

    /**
     * 获取pageCode
     */
    @RequestMapping(value = "platform/getPageCode", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Result<String> getPageCode(@RequestBody JSONObject jsonObject);

}
